package cn.edu.hqu.cst.android.cxy.test6_customer;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.os.Message;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity{
    EditText et_main_content;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        new Thread(new ClientThread()).start();
        System.out.println("66666666666");
        Button btn = findViewById(R.id.btn_main_send);
        et_main_content = findViewById(R.id.et_main_content);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                send();
            }
        });
    }
    public void send(){
        Message msg=new Message();
        msg.what=0x1234;
        Bundle bundle =new Bundle();
        bundle.putString("sendContent",et_main_content.getText().toString());
        msg.setData(bundle);
        ClientThread.sendHandler.sendMessage(msg);
    }
}